1. Field of the Invention
The present invention relates to an image processing apparatus, an imaging apparatus, and a range image generating method and a program, more particularly, to the image processing apparatus, the imaging apparatus, and the range image generating method and the program which can acquire an omni-focus image or a blur-enhanced image by focus bracketing.
2. Description of the Related Art
As a technique for acquiring an omni-focus image using a plurality of images acquired by focus bracketing (hereinafter referred to as focus-bracketed images), which consecutively captures object images while varying the focus position of a lens, Japanese Patent Application Laid-Open No. H06-311411 discloses a technique for generating a synthesized image without blurredness by judging contrast on each pixel in the focus-bracketed image using a differential filter (see SA-SA2 in FIG. 17), determining a region between pixels which have a contrast equal to or higher than a prescribed contrast and form a “pair” as a high contrast in-focus region (see SA3-SE in FIG. 17), and synthesizing only the pixels in the in-focus region from each image.
As a method for performing, using the focus-bracketed images, omni-focus processing in order to acquire an image (omni-focus image) where every object is in-focus in a frame or blur enhancement processing in order to acquire an image (blur-enhanced image) where a principal object is in-focus but the other objects are blurred beyond an actual depth of field, a method is used that judges which image is most focused among the focus-bracketed images on a pixel basis using sharpness calculated by a differential filter or the like on an image basis and a pixel basis and, based on the result, calculates a synthesized weighted coefficient for the omni-focus processing or a blurring amount for blur enhancement processing.